home *** CD-ROM | disk | FTP | other *** search
/ APDL Eductation Resources / APDL Eductation Resources.iso / programs / electronic / rlab / TestMatrix / hilb_r < prev    next >
Encoding:
Text File  |  1994-12-20  |  1.4 KB  |  45 lines

  1. //-------------------------------------------------------------------//
  2.  
  3. // Synopsis:    Hilbert matrix.
  4.  
  5. // Syntax:      H = hilb ( N )
  6.  
  7. // Description:
  8.  
  9. //      H is the N-by-N matrix with elements 1/(i+j-1). It is a famous
  10. //      example of a badly conditioned matrix. cond(hilb(N)) grows
  11. //      like EXP(3.5*N). See INVHILB (standard MATLAB routine) for the
  12. //      exact inverse, which has integer entries. Hilb(N) is symmetric
  13. //      positive definite, totally positive, and a Hankel matrix.
  14.  
  15. //      References:
  16. //       M.-D. Choi, Tricks or treats with the Hilbert matrix, Amer. Math.
  17. //           Monthly, 90 (1983), pp. 301-312.
  18. //       M. Newman and J. Todd, The evaluation of matrix inversion
  19. //           programs, J. Soc. Indust. Appl. Math., 6 (1958), pp. 466-476.
  20. //       D.E. Knuth, The Art of Computer Programming,
  21. //           Volume 1, Fundamental Algorithms, second edition, Addison-Wesley,
  22. //           Reading, Massachusetts, 1973, p. 37.
  23.  
  24. //    This file is a translation of hilb.m from version 2.0 of
  25. //    "The Test Matrix Toolbox for Matlab", described in Numerical
  26. //    Analysis Report No. 237, December 1993, by N. J. Higham.
  27.  
  28. // Dependencies
  29.    require cauchy
  30.  
  31. //-------------------------------------------------------------------//
  32.  
  33. hilb = function ( n )
  34. {
  35.   local (H)
  36.   if (n == 1)
  37.   {
  38.     H = 1;
  39.   else
  40.     H = cauchy( (1:n) - .5);
  41.   }
  42.  
  43.   return H;
  44. };
  45.